<template>
	<view class="subject-row-container">
		<module-title title="专题"></module-title>
		<scroll-view class="course-subject-scroll" scroll-x="true">
			<view v-for="item in list" :key="item.subjectId" class='course-subject-scroll-item '>
				<image :src="item.bannerFileUrl" mode='scaleToFill' />
			</view>
		</scroll-view>
	</view>
</template>

<script>
	import {
		subjectList
	} from '../../../api/course-api.js'
	import ModuleTitle from '../../../components/module-title/module-title.vue'
	export default {
		components: {
			ModuleTitle
		},
		data() {
			return {
				list: []
			}
		},
		created() {
			subjectList().then(res => {
				this.list = res.data.rows.length > 3 ? res.data.rows.slice(0, 3) : res.data.rows;
			})
		}
	}
</script>

<style lang="scss">
	.subject-row-container{
		padding: 20rpx 20rpx 0;
	}
	.course-subject-scroll {
		white-space: nowrap;

	
	}
	.course-subject-scroll-item {
		display: inline-block;
		margin-right: 30rpx;
	
		uni-image {
			width: 500rpx;
			height: 200rpx;
			border-radius: 5rpx;
		}
	}
</style>
